import { reqFindHeadCategory } from '@/api/home'
export default {
  namespaced: true,
  // 注意: 模块化的时候state是一个函数,数据写在返回的对象中
  state: () => {
    return {
      list: []
    }
  },
  mutations: {
    setList (state, list) {
      state.list = list
    }
  },
  actions: {
    async getList (context) {
      const { result } = await reqFindHeadCategory()
      context.commit('setList', result)
    }
  }
}
